<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Nativesession {

    public function __construct() {
        session_start();
        $_SESSION['session_id'] = session_id();
    }

    public function set_userdata($key, $value) {
        $_SESSION[$key] = $value;
    }

    public function userdata($key) {
        return isset($_SESSION[$key]) ? $_SESSION[$key] : false;
    }

    public function all_userdata() {
        return isset($_SESSION) ? $_SESSION : false;
    }

    public function unset_userdata($key) {
        unset($_SESSION[$key]);
    }

    public function sess_destroy() {
        session_destroy();
    }

}
